package com.jiutong.meipengdai.ui.activitys;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.gyf.barlibrary.ImmersionBar;
import com.jiutong.meipengdai.R;
import com.jiutong.meipengdai.utils.DensityUtil;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * 作用:
 * Created by 78 on 2017/6/19.
 */
public class MembershipCardActivity extends AppCompatActivity {

    @Bind(R.id.rl_back_membershipcard)
    RelativeLayout rlBackMembershipcard;
    @Bind(R.id.tv_title_membershipcard)
    TextView tvTitleMembershipcard;
    @Bind(R.id.rl_comment_title_membershipcard)
    RelativeLayout rlCommentTitleMembershipcard;
    @Bind(R.id.tv_membership_card)
    TextView tvMembershipCard;

    private String membershipCard;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_membershipcard);

        ButterKnife.bind(this);
        ImmersionBar.with(this)
                .init();

        FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) rlCommentTitleMembershipcard.getLayoutParams();
        params.topMargin = DensityUtil.getTitleBarHeight(this);//获取状态栏高度
        rlCommentTitleMembershipcard.setLayoutParams(params);

        tvTitleMembershipcard.setText("额度卡");
        Bundle bundle = getIntent().getExtras();
        if (bundle == null)
            return;
        membershipCard = bundle.getString("membershipcard");
        StringBuffer sb = new StringBuffer();
        String str = membershipCard.substring(0, 3) + sb.append("  ") + membershipCard.substring(3, 6) + sb.append("") + membershipCard.substring(6, 9) + sb.append("") + membershipCard.substring(9);
        tvMembershipCard.setText(str);
    }

    @OnClick(R.id.rl_back_membershipcard)
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.rl_back_membershipcard:
                finish();
                break;
        }
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        ButterKnife.unbind(this);
    }
}
